/*     */ package com.feeyin.radar.sys.service.impl;
/*     */ 
/*     */ import com.feeyin.radar.commons.DateUtils;
/*     */ import com.feeyin.radar.commons.StringUtils;
/*     */ import com.feeyin.radar.sys.dao.CountryDAO;
/*     */ import com.feeyin.radar.sys.dao.RecordRangeDAO;
/*     */ import com.feeyin.radar.sys.model.Country;
/*     */ import com.feeyin.radar.sys.model.RecordRange;
/*     */ import com.feeyin.radar.sys.service.RecordRangeService;
/*     */ import java.util.ArrayList;
/*     */ import java.util.Date;
/*     */ import java.util.List;
/*     */ 
/*     */ public class RecordRangeServiceImpl
/*     */   implements RecordRangeService
/*     */ {
/*     */   private RecordRangeDAO recordRangeDAO;
/*     */   private CountryDAO countryDAO;
/*     */ 
/*     */   public RecordRangeDAO getRecordRangeDAO()
/*     */   {
/*  27 */     return this.recordRangeDAO;
/*     */   }
/*     */ 
/*     */   public void setRecordRangeDAO(RecordRangeDAO recordRangeDAO) {
/*  31 */     this.recordRangeDAO = recordRangeDAO;
/*     */   }
/*     */ 
/*     */   public CountryDAO getCountryDAO() {
/*  35 */     return this.countryDAO;
/*     */   }
/*     */ 
/*     */   public void setCountryDAO(CountryDAO countryDAO) {
/*  39 */     this.countryDAO = countryDAO;
/*     */   }
/*     */ 
/*     */   public List getActivityRecordRangesByDictionaryId(Integer dictionaryId) {
/*  43 */     return this.recordRangeDAO.getActivityRecordRangesByDictionaryId(dictionaryId);
/*     */   }
/*     */ 
/*     */   public List getRecordRangesByDictionaryId(Integer dictionaryId) {
/*  47 */     return this.recordRangeDAO.getRecordRangesByDictionaryId(dictionaryId);
/*     */   }
/*     */ 
/*     */   public List getActivityRecordRangesByDictionaryCode(String recordCode) {
/*  51 */     return this.recordRangeDAO.getActivityRecordRangesByDictionaryCode(recordCode);
/*     */   }
/*     */ 
/*     */   public List getActivityIndustryRanges() {
/*  55 */     return this.recordRangeDAO.getActivityRecordRangesByParentId(Integer.valueOf(0));
/*     */   }
/*     */ 
/*     */   public List getActivityRecordRangesByParentId(Integer parentId) {
/*  59 */     return this.recordRangeDAO.getActivityRecordRangesByParentId(parentId);
/*     */   }
/*     */ 
/*     */   public List getActivityRecordRangesByLevel(Integer level) {
/*  63 */     return this.recordRangeDAO.getActivityRecordRangesByLevel(level);
/*     */   }
/*     */ 
/*     */   public List getCountryRanges() {
/*  67 */     return this.countryDAO.getCountrysByParentId(Integer.valueOf(0));
/*     */   }
/*     */ 
/*     */   public List getProvinceRanges(Integer countryId) {
/*  71 */     return this.countryDAO.getCountrysByParentId(countryId);
/*     */   }
/*     */ 
/*     */   public List getCityRanges(Integer provinceId) {
/*  75 */     return this.countryDAO.getCountrysByParentId(provinceId);
/*     */   }
/*     */ 
/*     */   public boolean isRepeatRecordRange(Integer dictionaryId, String rangeValue) {
/*  79 */     if ((dictionaryId == null) || (StringUtils.isEmpty(rangeValue))) return false;
/*  80 */     List list = new ArrayList();
/*  81 */     list = this.recordRangeDAO.getActivityRecordRangesByDictionaryIdAndRangeValue(dictionaryId, rangeValue);
/*  82 */     return (list != null) && (list.size() > 0);
/*     */   }
/*     */ 
/*     */   public boolean isRepeatIndustryDetail(Integer parentId, String rangeValue)
/*     */   {
/*  87 */     if ((parentId == null) || (StringUtils.isEmpty(rangeValue))) return false;
/*  88 */     List list = new ArrayList();
/*  89 */     list = this.recordRangeDAO.getActivityRecordRangesByParentIdAndRangeValue(parentId, rangeValue);
/*  90 */     return (list != null) && (list.size() > 0);
/*     */   }
/*     */ 
/*     */   public boolean isRepeatCountry(RecordRange recordRange)
/*     */   {
/*  95 */     if (recordRange == null) return false;
/*  96 */     Country country = new Country();
/*  97 */     country.setParentId(Integer.valueOf(0));
/*  98 */     country.setCName(recordRange.getRangeValue());
/*  99 */     List list = new ArrayList();
/* 100 */     list = this.countryDAO.getCountrysByParentIdAndCName(country);
/* 101 */     return (list != null) && (list.size() > 0);
/*     */   }
/*     */ 
/*     */   public boolean isRepeatProvince(Country country)
/*     */   {
/* 106 */     if (country == null) return false;
/* 107 */     List list = new ArrayList();
/* 108 */     list = this.countryDAO.getCountrysByParentIdAndCName(country);
/* 109 */     return (list != null) && (list.size() > 0);
/*     */   }
/*     */ 
/*     */   public boolean isRepeatCity(Country country)
/*     */   {
/* 114 */     if (country == null) return false;
/* 115 */     country.setParentId(country.getProvinceId());
/* 116 */     List list = new ArrayList();
/* 117 */     list = this.countryDAO.getCountrysByParentIdAndCName(country);
/* 118 */     return (list != null) && (list.size() > 0);
/*     */   }
/*     */ 
/*     */   public boolean insertRecordRange(RecordRange recordRange)
/*     */   {
/* 123 */     if (recordRange == null) return false;
/* 124 */     String rangeCode = DateUtils.getStringDateByFormat(new Date(), "yyyyMMddHHmmss");
/* 125 */     recordRange.setRangeCode(rangeCode);
/* 126 */     if ("110".equals(recordRange.getRecordCode())) {
/* 127 */       recordRange.setParentId(Integer.valueOf(0));
/* 128 */       recordRange.setLevel(Integer.valueOf(1));
/* 129 */     } else if ("127".equals(recordRange.getRecordCode())) {
/* 130 */       recordRange.setLevel(Integer.valueOf(2));
/*     */     }
/* 132 */     return this.recordRangeDAO.insertRecordRange(recordRange);
/*     */   }
/*     */ 
/*     */   public boolean insertCountryRange(RecordRange recordRange) {
/* 136 */     if (recordRange == null) return false;
/* 137 */     String code = DateUtils.getStringDateByFormat(new Date(), "yyyyMMddHHmmss");
/* 138 */     Country country = new Country();
/* 139 */     country.setCode(code);
/* 140 */     country.setCName(recordRange.getRangeValue());
/* 141 */     country.setCNameEn(recordRange.getRangeValueEn());
/* 142 */     country.setLevel(Integer.valueOf(1));
/* 143 */     country.setParentId(Integer.valueOf(0));
/* 144 */     return this.countryDAO.insertCountry(country);
/*     */   }
/*     */ 
/*     */   public boolean insertCountryRange(Country country) {
/* 148 */     if (country == null) return false;
/* 149 */     String code = DateUtils.getStringDateByFormat(new Date(), "yyyyMMddHHmmss");
/* 150 */     country.setCode(code);
/* 151 */     country.setCNameEn(country.getCNameEn());
/* 152 */     country.setCName(country.getCName());
/*     */ 
/* 154 */     if (("125".equals(country.getRecordCode())) || ("218".equals(country.getRecordCode()))) {
/* 155 */       country.setLevel(Integer.valueOf(2));
/* 156 */     } else if (("126".equals(country.getRecordCode())) || ("219".equals(country.getRecordCode()))) {
/* 157 */       country.setParentId(country.getProvinceId());
/* 158 */       country.setLevel(Integer.valueOf(3));
/*     */     }
/* 160 */     return this.countryDAO.insertCountry(country);
/*     */   }
/*     */ 
/*     */   public boolean deleteRecordRange(Integer id) {
/* 164 */     return this.recordRangeDAO.updateRecordRangeNotActivity(id);
/*     */   }
/*     */ 
/*     */   public boolean deleteCountry(Integer id) {
/* 168 */     return this.countryDAO.deleteCountry(id);
/*     */   }
/*     */ }

/* Location:           C:\Users\e547415\MyProject\rone\WEB-INF\classes\
 * Qualified Name:     com.feeyin.radar.sys.service.impl.RecordRangeServiceImpl
 * JD-Core Version:    0.6.0
 */